﻿using System;
using System.ComponentModel.Composition;
using System.Windows.Controls;
using System.Windows.Data;
using TrackMe.Apps.Views;

namespace TrackMe.View.Frames
{
    [Export(typeof(IReportView))]
    [PartCreationPolicy(CreationPolicy.NonShared)]
    public partial class Report : IReportView
    {
        public Report()
        {
            InitializeComponent();
        }

        public void AddColumn(string binding, string caption)
        {
            var col = new GridViewColumn {Header = caption};
            col.DisplayMemberBinding = new Binding(binding);
            col.Width = double.NaN;
            grid.Columns.Add(col);
        }

        public void AddRow(object[] cells)
        {
            var item = list.Items.Add(cells);
        }

    	public void Clear()
    	{
    		grid.Columns.Clear();
			list.Items.Clear();
    	}
    }
}
